////
////  ThirdPartQQ.m
////  Screen
////
////  Created by Season02 on 9/29/16.
////  Copyright © 2016 alex.chih. All rights reserved.
////
//
//#import "ThirdPartQQ.h"
//#import "QQEntity.h"
//#import "ThirdDefine.h"
////#import "MGCLoginRegisterViewController.h"
////#import "MGCTabBarController.h"
//
//#import "ThirdDefine.h"
//
//#import "OverRun-Swift.h"
//
//static TencentOAuth *tencentOAuth;
//static NSArray* qqPermissions;
//
//@interface ThirdPartQQ ()
//////qq组件
//
////@property (strong, nonatomic) NSArray* qqPermissions;
//@end
//
//@implementation ThirdPartQQ
//
//
//
//-(void)qqInit
//{
//    /* QQ init */
//    if(tencentOAuth == nil)
//    {
//        tencentOAuth = [[TencentOAuth alloc] initWithAppId:@"1105253955" andDelegate:self];
//        qqPermissions = [NSArray arrayWithObjects:@"get_user_info", @"add_share", nil];
//    }
//}
//
//+(void)login
//{
//    [tencentOAuth authorize:qqPermissions inSafari:NO];
//}
//
//+(BOOL)installed
//{
//    return [TencentOAuth iphoneQQInstalled];
//}
//
//+(void)shareToFriend:(ShareType)type eid:(NSString*)eid title:(NSString*)titile image:(NSString*)image
//{
////    NSString* pri;
////    
////    if(type == ShareTypeArtic)
////        pri = APrifix;
////    else
////        pri = VPrifix;
//    
//    NSString *utf8String = [CommonShare GenerateUrl:type eid: eid];//[NSString stringWithFormat:@"%@%@", pri, eid];
//    NSString *title = titile;
//
//    NSString *previewImageUrl = image;
//    QQApiNewsObject *newsObj = [QQApiNewsObject
//                                objectWithURL:[NSURL URLWithString:utf8String]
//                                title:title
//                                description:nil
//                                previewImageURL:[NSURL URLWithString:previewImageUrl]];
//    SendMessageToQQReq *req = [SendMessageToQQReq reqWithContent:newsObj];
//    //将内容分享到qq
//    [QQApiInterface sendReq:req];
//}
//
////+(void)shareToFriend:(MGCMedias*)media
////{
////    NSString *utf8String = [NSString stringWithFormat:@"%@%@", VPrifix, media.vid];
////    NSString *title = media.title;
////    //NSString *description = @"新闻描述";
////    NSString *previewImageUrl = media.picMinPath;
////    QQApiNewsObject *newsObj = [QQApiNewsObject
////                                objectWithURL:[NSURL URLWithString:utf8String]
////                                title:title
////                                description:nil
////                                previewImageURL:[NSURL URLWithString:previewImageUrl]];
////    SendMessageToQQReq *req = [SendMessageToQQReq reqWithContent:newsObj];
////    //将内容分享到qq
////    [QQApiInterface sendReq:req];
////    //将内容分享到qzone
////    //QQApiSendResultCode sent = [QQApiInterface SendReqToQZone:req];
////}
//
//+(void)shareToQZone:(ShareType)type eid:(NSString*)eid title:(NSString*)titile image:(NSString*)image
//{
//    NSString *utf8String = [CommonShare GenerateUrl:type eid: eid];//[NSString stringWithFormat:@"%@%@", pri, eid];
//    NSString *title = titile;
//    
//    NSString *previewImageUrl = image;
//    QQApiNewsObject *newsObj = [QQApiNewsObject
//                                objectWithURL:[NSURL URLWithString:utf8String]
//                                title:title
//                                description:nil
//                                previewImageURL:[NSURL URLWithString:previewImageUrl]];
//    SendMessageToQQReq *req = [SendMessageToQQReq reqWithContent:newsObj];
//    //将内容分享到qq
//    [QQApiInterface SendReqToQZone:req];
//}
//
////+(void)shareToQZone:(MGCMedias*)media
////{
////    NSString *utf8String = [NSString stringWithFormat:@"%@%@", VPrifix, media.vid];
////    NSString *title = media.title;
////    //NSString *description = @"新闻描述";
////    NSString *previewImageUrl = media.picMinPath;
////    QQApiNewsObject *newsObj = [QQApiNewsObject
////                                objectWithURL:[NSURL URLWithString:utf8String]
////                                title:title
////                                description:nil
////                                previewImageURL:[NSURL URLWithString:previewImageUrl]];
////    SendMessageToQQReq *req = [SendMessageToQQReq reqWithContent:newsObj];
////    //将内容分享到qq
////    //[QQApiInterface sendReq:req];
////    //将内容分享到qzone
//////    QQApiSendResultCode sent = [QQApiInterface SendReqToQZone:req];
////    [QQApiInterface SendReqToQZone:req];
////}
//
///**
// * qq登录成功后的回调
// */
//- (void)tencentDidLogin
//{
//    //NSLog(@"QQ登录完成");
//    if (tencentOAuth.accessToken && 0 != [tencentOAuth.accessToken length])
//    {
//        // 记录登录用户的OpenID、Token以及过期时间
//        [[NSUserDefaults standardUserDefaults] setObject:tencentOAuth.accessToken forKey:SeThirdKeyQQ_Token];
//        [[NSUserDefaults standardUserDefaults] setObject:tencentOAuth.openId forKey:SeThirdKeyQQ_OpenId];
//        [[NSUserDefaults standardUserDefaults] setObject:tencentOAuth.expirationDate forKey:SeThirdKeyQQ_ExpirationDate];
//        
//        [tencentOAuth getUserInfo];
//    }
//    else
//    {
//        NSLog(@"登录不成功 没有获取accesstoken");
//    }
//}
//
///* QQ获取用户信息 成功回调 */
//-(void)getUserInfoResponse:(APIResponse *)response
//{
//    NSLog(@"respons.jsonResponse:%@",response.jsonResponse);
//    
//    QQEntity *entity = [QQEntity initWithDict:response.jsonResponse];
//    [entity setOpenId:tencentOAuth.openId];
//    
//    if([MGCLoginRegisterViewController genericLoginProcess:entity])
//    {
//        //[self dismissViewControllerAnimated:YES completion:nil];
//        //UIApplication.sharedApplication.delegate.window.rootViewController = [[MGCTabBarController alloc] init];
//    }
//}
//
///**
// * qq登录失败后的回调
// *     param cancelled 代表用户是否主动退出登录
// */
//- (void)tencentDidNotLogin:(BOOL)cancelled
//{
//    if (cancelled)
//    {
//        NSLog(@"用户取消登录");
//    }
//    else
//    {
//        NSLog(@"登录失败");
//    }
//}
//
///**
// * qq登录时网络有问题的回调
// */
//- (void)tencentDidNotNetWork
//{
//    //    _labelTitle.text=@"无网络连接，请设置网络";
//    NSLog(@"无网络链接，请设置网络");
//}
//
//
//@end
